<?php
namespace app\rechargecard\validate;
use think\Validate;
class RechargeCard extends Validate {
    //验证字段
    protected $rule = [
        'id' => ['require','number'],
        'account_id' => ['require'],
        'recharge_card' => ['require'],
        'recharge_time' => ['require','number'],
        'amount' => ['require'],
        'status' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'id.require' => 'id必须',
        'id.number' => 'id不是数字',
        'account_id.require' => '账户必须',
        'recharge_card.require' => '充值卡必须',
        'recharge_time.require' => '充值时间必须',
        'recharge_time.number' => '充值时间不是数字',
        'amount.require' => '金额必须',
        'status.require' => '状态必须',
        'status.number' => '状态不是数字',
    ];

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','account_id','recharge_card','recharge_time','amount','status']);
    }

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['account_id','recharge_card','recharge_time','amount','status']);
    }
}
